package ro.isdc.training.ejb3.student.service.domain;

import ro.isdc.training.ejb3.misc.service.domain.ServiceResponse;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Response to the enrollToCourse() service.
 * 
 * @author Andrei Chirila
 */
public class EnrollToCourseResponse extends ServiceResponse {
  
  /**
   * Generated Serial Version UID
   */
  private static final long serialVersionUID = -2965941462834805104L;
  
  /**
   * Boolean value representing the successful/unsuccessful enrollment
   * of a student to a course
   */
  private boolean enrolled;

  /**
   * @return the enrolled
   */
  public boolean isEnrolled() {
    return enrolled;
  }

  /**
   * @param enrolled the enrolled to set
   */
  public void setEnrolled(boolean enrolled) {
    this.enrolled = enrolled;
  }

  /**
   * @see java.lang.Object#equals(Object)
   */
  public boolean equals(final Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof EnrollToCourseResponse)) {
      return false;
    }
    EnrollToCourseResponse rhs = (EnrollToCourseResponse) object;
    return new EqualsBuilder().append(this.enrolled, rhs.enrolled).isEquals();
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  public int hashCode() {
    return new HashCodeBuilder(-863367195, 226961).append(this.enrolled)
        .toHashCode();
  }

  /**
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append(
        "enrolled", this.enrolled).toString();
  }
  
}
